<?php
namespace Home\Controller;
class IndexController extends BaseController {
    public function Index(){

    	$channel = M('category')->where(array('status'=>1))->order('sort desc')->limit(20)->select();

       $dModel =  D('Data');
    	$this->assign("new_message",$dModel->getMessage());
		//print_r($dModel->getMessage());
    	$this->assign("jianlis",  $dModel->getJianli());

    	$this->assign("channel",$channel);
    	$this->display();
    }
    
    public function view (){
    	$id = I('get.message',0,'intval');
        $message = D('Data')->oneMessage($id);
         if(empty($message)){
         	$this->error("信息不存在！");
         }
    //     print_r( $message);
        $this->assign("message",$message);
    	$this->display();
    }
    
    public function lis(){
    	$lid = I('get.lid',0,'intval');
    	$this->totalRows =100;
    	$this->pages();
    	$category=D('category')->categoryInfo($lid);
    	if(empty($category)){
    		//header('Content-type:')
    		$this->error("类目不存在！");
    	}
    	$this->totalRows = $this->getCount("DataMessage", array('channel'=>$lid));
    	$this->assign("page",$this->pages());
    	$lists = D('Data')->getMsgByChid($lid,$this->utilLimit($this->p));
    	$this->assign("lists",$lists);
    	$this->assign("category",$category);
    	$this->display('list-org');
    }
    
    
    
}